package com.ruoyi.training.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.training.domain.CurriculumChapter;
import com.ruoyi.training.mapper.CurriculumChapterMapper;
import com.ruoyi.training.service.ICurriculumChapterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 课程章节管理Service业务层处理
 *
 * @author wng
 * @date 2024-08-04
 */
@Service
public class CurriculumChapterServiceImpl implements ICurriculumChapterService {
    @Resource
    private CurriculumChapterMapper curriculumChapterMapper;

    /**
     * 查询课程章节管理
     *
     * @param id 课程章节管理主键
     * @return 课程章节管理
     */
    @Override
    public CurriculumChapter selectCurriculumChapterById(Long id) {
        return curriculumChapterMapper.selectCurriculumChapterById(id);
    }

    /**
     * 查询课程章节管理列表
     *
     * @param curriculumChapter 课程章节管理
     * @return 课程章节管理
     */
    @Override
    public List<CurriculumChapter> selectCurriculumChapterList(CurriculumChapter curriculumChapter) {
        return curriculumChapterMapper.selectCurriculumChapterList(curriculumChapter);
    }

    /**
     * 新增课程章节管理
     *
     * @param curriculumChapter 课程章节管理
     * @return 结果
     */
    @Override
    public int insertCurriculumChapter(CurriculumChapter curriculumChapter) {
        curriculumChapter.setCreateTime(DateUtils.getNowDate());
        return curriculumChapterMapper.insertCurriculumChapter(curriculumChapter);
    }

    /**
     * 修改课程章节管理
     *
     * @param curriculumChapter 课程章节管理
     * @return 结果
     */
    @Override
    public int updateCurriculumChapter(CurriculumChapter curriculumChapter) {
        curriculumChapter.setUpdateTime(DateUtils.getNowDate());
        return curriculumChapterMapper.updateCurriculumChapter(curriculumChapter);
    }

    /**
     * 批量删除课程章节管理
     *
     * @param ids 需要删除的课程章节管理主键
     * @return 结果
     */
    @Override
    public int deleteCurriculumChapterByIds(Long[] ids) {
        return curriculumChapterMapper.deleteCurriculumChapterByIds(ids);
    }

    /**
     * 删除课程章节管理信息
     *
     * @param id 课程章节管理主键
     * @return 结果
     */
    @Override
    public int deleteCurriculumChapterById(Long id) {
        return curriculumChapterMapper.deleteCurriculumChapterById(id);
    }
}
